#ifndef CAMERA6467_PALTE_H
#define CAMERA6467_PALTE_H

#include "BaseCamera.h"
#include "cameraModule/ResultListManager.h"
#include "cameraModule/cXmlResult.h"
//#include "CameraModule/ThreadSafeList.h"
#include <map>
#include <thread>

namespace libcvos_vfr
{

	class Camera6467_plate : public BaseCamera
	{
	public:
		Camera6467_plate();
		virtual ~Camera6467_plate();

		bool GetResultComplete();
		void SetResultComplete(bool bfinish);

		CameraResult* GetOneResult();
		std::shared_ptr<CameraResult> GetResultByResultNo(unsigned int resultID);

		void SaveResult();

        void SetDeviceId(unsigned long uID);
        unsigned long GetDeviceID();

		void SetMsgThreadId(unsigned long id);
		unsigned long GetMsgThreadId();

		void AnalysisAppendInfo(CameraResult* pResult);
		void PopulateResultByXMLAttribute(CameraResult* pResult, const CXmlResult& xmlResult);

        void sendResultByCallback(CameraResult* pResult, int type = 0);
        void sendStatusBycallback(int iStatus);

        void setCallbackMsg(unsigned int iDataMsg, unsigned int iConnectMsg, unsigned int iDisconnectMsg);

	private:
		void ReadConfig();

	private:

		int m_iTimeInvl;
		int m_iCompressBigImgSize;
		int m_iCompressSamllImgSize;
		int m_iCompressBigImgWidth;
        int m_iCompressBigImgHeight;

        unsigned int m_iDataReceiveMsg;
        unsigned int m_iConnectMsg;
        unsigned int m_iDisConMsg;

        unsigned long m_iDeviceID;

		unsigned long m_dwMsgThreadID;

		bool m_bResultComplete;

		bool m_bSaveToBuffer;
		bool m_bOverlay;
		bool m_bCompress;
		bool m_bProvideBigImg;
		bool m_bUseHwnd;
		bool m_bCompressEnable;

		CameraResult* m_pResult;
        CameraResult* m_pBufferResult;

        ResultListManager m_lsResultList;

	private:
		
		virtual int DeviceJPEGStream(
			unsigned char* pbImageData,
			unsigned long dwImageDataLen,
			unsigned long dwImageType,
			const char* szImageExtInfo);

		virtual int OnHvResultILLEGALVideo(
			unsigned long dwCarID,
			unsigned long dwVideoType,
			unsigned long dwVideoWidth,
			unsigned long dwVideoHeight,
			unsigned long long dw64TimeMS,
			unsigned char *pbVideoData,
			unsigned long dwVideoDataLen,
			const char *szVideoExtInfo);

        virtual int OnHvResult_callback(
                unsigned long dwResultFlag,
                unsigned long dwResultType,
                unsigned long dwCarID,
                const char *pcPlateNo,
                const char *pcAppendInfo,
                unsigned long long dw64TimeMS,
                CImageInfo   Plate,
                CImageInfo   PlateBin,
                CImageInfo   BestSnapshot,
                CImageInfo   LastSnapshot,
                CImageInfo   BeginCapture,
                CImageInfo   BestCapture,
                CImageInfo   LastCapture
                );

		virtual void CheckStatus();

        virtual void SendResult();
	};

}

#endif
